﻿using Architecture.Api.Application.Commands.RoleCommand;
using Architecture.Domain.Services.Interface;
using Architecture.Domian.Common;
using Architecture.Domian.Entity;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.RoleHandler
{
    public class RoleReadCommandHandler : IRequestHandler<RoleReadCommand, PageResult<RoleInfo>>
    {
        private readonly IRoleSerivce _roleService;

        public RoleReadCommandHandler(IRoleSerivce roleService)
        {
            _roleService = roleService;
        }

        public async Task<PageResult<RoleInfo>> Handle(RoleReadCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetRoleList(request.Size, request.Index);
        }
    }
}
